{extend name="base" /}
{block name="header"}
<link rel="stylesheet" href="__STATIC__/admin/modules/editor/wangeditor.css">
{/block}
{block name="body"}
<div class="layui-fluid">
    <div class="layui-card">
        <!--tab标签-->
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class=""><a href="{:url('admin/article/index')}">內容管理</a></li>
                <li class="layui-this">编辑內容</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form form-container" action="{:url('admin/article/update')}" method="post">
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属分类</label>
                            <div class="layui-input-block">
                                <select name="cid" lay-verify="required">
                                    {foreach name="category_level_list" item="vo"}
                                    <option value="{$vo.id}" {if condition="$article.cid==$vo.id"} selected="selected"{/if}>{neq name="vo.level" value="1"}|{php}for($i=1;$i<$vo['level'];$i++){echo ' ----';}{/php}{/neq} {$vo.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">标题</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" value="{$article.title}" required  lay-verify="required" placeholder="请输入标题" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">缩略图</label>
                            <div class="layui-input-block">
                                <input type="text" name="thumb" value="{$article.thumb}" style="width: 80%" placeholder="（选填）请上传封面" class="layui-input layui-input-inline" id="thumb-url">
                                <button type="button" class="layui-btn" data-upload-url="{:url("/upload/upload")}" id="thumb"><i class="layui-icon">&#xe67c;</i>选择文件</button>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">文档附件</label>
                            <div class="layui-input-block">
                                <input type="text" name="file_name" value="{$article.file_name}" lay-verify="required" style="width: 80%" placeholder="（必填）请上传文件" class="layui-input layui-input-inline" id="interface-url">
                                <button type="button" class="layui-btn" data-upload-url="{$site_info.interface_url}/upload" id="interface"><i class="layui-icon">&#xe67c;</i>选择文件</button>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">文档标签</label>
                            <div class="layui-input-block">
                                <input type="text" name="tags" value="{$article.tags}" placeholder="（选填）请填写文档标签,逗号隔开"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">文档价格</label>
                            <div class="layui-input-block">
                                <input type="text" name="price" value="{$article.price}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">内容</label>
                            <div class="layui-input-block">
                                <div id="editor" style="height:500px;">{$article.content | raw}</div>
                                <textarea class="editor-textarea" name="content" style="display: none">{$article.content | raw}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-block">
                                <input type="radio" name="status" value="1" title="已审核" {if condition="$article.status==1"} checked="checked"{/if}>
                                <input type="radio" name="status" value="0" title="未审核" {if condition="$article.status==0"} checked="checked"{/if}>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">置顶</label>
                            <div class="layui-input-block">
                                <input type="radio" name="is_top" value="1" title="置顶" {if condition="$article.is_top==1"} checked="checked"{/if}>
                                <input type="radio" name="is_top" value="0" title="未置顶" {if condition="$article.is_top==0"} checked="checked"{/if}>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">推荐</label>
                            <div class="layui-input-block">
                                <input type="radio" name="is_recommend" value="1" title="推荐" {if condition="$article.is_recommend==1"} checked="checked"{/if}>
                                <input type="radio" name="is_recommend" value="0" title="未推荐" {if condition="$article.is_recommend==0"} checked="checked"{/if}>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">免费</label>
                            <div class="layui-input-block">
                                <input type="radio" name="is_free" value="1" title="是" {if condition="$article.is_free==1"} checked="checked"{/if}>
                                <input type="radio" name="is_free" value="0" title="否" {if condition="$article.is_free==0"} checked="checked"{/if}>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">排序</label>
                            <div class="layui-input-block">
                                <input type="text" name="sort" value="{$article.sort}" required  lay-verify="required" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" name="id" value="{$article.id}">
                                <input type="hidden" name="bid"  value="{$article.bid}" class="bid"/>
                                <input type="hidden" name="ext" value="{$article.ext}"  class="ext"/>
                                <input type="hidden" name="preview" value="{$article.preview}" class="preview"/>
                                <button class="layui-btn" lay-submit lay-filter="*">更新</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}